<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是系统烧写——在ubuntu中通过shell脚本制作一个sd卡启动盘的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV05-06-系统烧写-01-shell脚本烧写系统到SD卡">
<meta property="og:url" content="https://sumumm.github.io/post/f6996dcc.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是系统烧写——在ubuntu中通过shell脚本制作一个sd卡启动盘的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110114412706.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125140902.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125156470.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125213942.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125231547.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125253584.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125346905.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125508014.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130013750.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130147577.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130737351.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130836816.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131025774.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131146349.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131301570.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132615593.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132239941.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132424812.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132904767.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132956376.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110133311760.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110133753211.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134037145.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134754488.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134940658.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110140850593.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110141146802.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110141814036.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110153008072.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110153237641.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110155904254.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110165409967.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110170524143.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171021545.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171407795.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171614078.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171635675.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171734729.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154318160.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171635675.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110172120026.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110172207362.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110162432151.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110144506677.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154745853.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154853628.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110180201860.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110180810646.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110181039165.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110181634105.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20240117190003663.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110182125122.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111210347645.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111210621620.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111211758170.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111211925133.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111212008521.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111212207419.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111213032658.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111213103247.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241112220637919.png">
<meta property="article:published_time" content="2024-11-19T15:38:43.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.047Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="LV05-系统镜像">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110114412706.png">


<link rel="canonical" href="https://sumumm.github.io/post/f6996dcc.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":"","permalink":"https://sumumm.github.io/post/f6996dcc.html","path":"post/f6996dcc.html","title":"LV05-06-系统烧写-01-shell脚本烧写系统到SD卡"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV05-06-系统烧写-01-shell脚本烧写系统到SD卡 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E6%9C%89%E5%93%AA%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F"><span class="nav-text">一、有哪些文件？</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E6%80%8E%E4%B9%88%E7%BB%99SD%E5%8D%A1%E5%88%86%E5%8C%BA"><span class="nav-text">二、怎么给SD卡分区</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%9F%A5%E7%9C%8BSD%E5%8D%A1%E4%BF%A1%E6%81%AF%EF%BC%8C%E7%A1%AE%E5%AE%9A%E6%8C%82%E8%BD%BD%E7%82%B9"><span class="nav-text">1. 查看SD卡信息，确定挂载点</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E6%8F%92%E5%85%A5sd%E5%8D%A1"><span class="nav-text">1.1 插入sd卡</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4"><span class="nav-text">1.2 相关命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-%E7%A1%AE%E5%AE%9A%E6%8C%82%E8%BD%BD%E7%82%B9"><span class="nav-text">1.3 确定挂载点</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%8D%B8%E8%BD%BDSD%E5%8D%A1"><span class="nav-text">2. 卸载SD卡</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E5%88%86%E5%8C%BA%E6%93%8D%E4%BD%9C"><span class="nav-text">3. 分区操作</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E8%BF%9B%E5%85%A5%E5%88%86%E5%8C%BA%E8%8F%9C%E5%8D%95"><span class="nav-text">3.1 进入分区菜单</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-m%E2%80%94%E2%80%94%E6%9F%A5%E7%9C%8B%E5%91%BD%E4%BB%A4%E8%8F%9C%E5%8D%95"><span class="nav-text">3.2 m——查看命令菜单</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-p%E2%80%94%E2%80%94%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8DSD%E5%8D%A1%E7%8A%B6%E6%80%81"><span class="nav-text">3.3 p——查看当前SD卡状态</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E5%88%9B%E5%BB%BA%E5%88%86%E5%8C%BA"><span class="nav-text">3.4 创建分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-%E8%AE%BE%E7%BD%AE%E5%88%86%E5%8C%BA%E7%B1%BB%E5%9E%8B"><span class="nav-text">3.5 设置分区类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-%E5%86%99%E5%85%A5%E5%88%86%E5%8C%BA"><span class="nav-text">3.6 写入分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-7-%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%88%86%E5%8C%BA"><span class="nav-text">3.7 格式化分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-8-%E5%88%A0%E9%99%A4%E5%88%86%E5%8C%BA"><span class="nav-text">3.8 删除分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-9-%E6%8C%82%E8%BD%BD%E5%88%86%E5%8C%BA"><span class="nav-text">3.9 挂载分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-10-%E5%8D%B8%E8%BD%BD%E5%88%86%E5%8C%BA"><span class="nav-text">3.10 卸载分区</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81SD%E5%8D%A1%E5%90%AF%E5%8A%A8%E7%9B%98%E5%88%B6%E4%BD%9C"><span class="nav-text">三、SD卡启动盘制作</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99"><span class="nav-text">1. 参考资料</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-SD%E5%8D%A1%E5%88%86%E5%8C%BA%E6%83%85%E5%86%B5%E8%AF%B4%E6%98%8E"><span class="nav-text">2. SD卡分区情况说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E5%AF%B9SD%E5%8D%A1%E9%87%8D%E6%96%B0%E5%88%86%E5%8C%BA"><span class="nav-text">3. 对SD卡重新分区</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E7%A1%AE%E8%AE%A4%E8%8A%82%E7%82%B9%E5%90%8D%E7%A7%B0"><span class="nav-text">3.1 确认节点名称</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E5%8D%B8%E8%BD%BD%E6%89%80%E6%9C%89%E5%88%86%E5%8C%BA"><span class="nav-text">3.2 卸载所有分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E6%B8%85%E7%A9%BASD%E5%8D%A1"><span class="nav-text">3.3 清空SD卡</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E4%B8%A4%E4%B8%AA%E5%88%86%E5%8C%BA"><span class="nav-text">3.4 两个分区</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-1-%E5%88%86%E5%8C%BA1%E2%80%94%E2%80%9464M"><span class="nav-text">3.4.1 分区1——64M</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-2-%E5%88%86%E5%8C%BA2%E2%80%94%E2%80%94%E5%89%A9%E4%BD%99%E9%83%A8%E5%88%86"><span class="nav-text">3.4.2 分区2——剩余部分</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-3-%E8%AE%BE%E7%BD%AE%E5%88%86%E5%8C%BA%E6%A0%BC%E5%BC%8F"><span class="nav-text">3.4.3 设置分区格式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-4-%E6%9C%80%E7%BB%88%E5%88%86%E5%8C%BA%E6%83%85%E5%86%B5"><span class="nav-text">3.4.4 最终分区情况</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-5-%E5%86%99%E5%85%A5%E5%88%86%E5%8C%BA"><span class="nav-text">3.4.5 写入分区</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%88%86%E5%8C%BA"><span class="nav-text">3.5 格式化分区</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-SD%E5%8D%A1%E5%88%86%E5%8C%BA%E6%83%85%E5%86%B5%E5%88%86%E6%9E%90"><span class="nav-text">3.6 SD卡分区情况分析</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E7%83%A7%E5%86%99uboot%E5%88%B0sd%E5%8D%A1"><span class="nav-text">4. 烧写uboot到sd卡</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E6%8B%B7%E8%B4%9Dkernel%E5%92%8Cdtbs"><span class="nav-text">5. 拷贝kernel和dtbs</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E6%8B%B7%E8%B4%9D%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1"><span class="nav-text">6. 拷贝文件系统到SD卡</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1-%E6%8B%B7%E8%B4%9D%E6%96%87%E4%BB%B6"><span class="nav-text">6.1 拷贝文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2-%E8%A7%A3%E5%8E%8B%E6%A0%B9%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F"><span class="nav-text">6.2 解压根文件系统</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3-%E6%8B%B7%E8%B4%9D%E5%88%B0%E9%A1%B6%E5%B1%82%E7%9B%AE%E5%BD%95"><span class="nav-text">6.3 拷贝到顶层目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4-%E5%8F%96%E6%B6%88%E6%8C%82%E8%BD%BD"><span class="nav-text">6.4 取消挂载</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-%E6%80%BB%E7%BB%93"><span class="nav-text">7. 总结</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E4%BB%8ESD%E5%8D%A1%E5%90%AF%E5%8A%A8"><span class="nav-text">四、从SD卡启动</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%8B%A8%E7%A0%81%E5%BC%80%E5%85%B3%E8%AE%BE%E7%BD%AE"><span class="nav-text">1. 拨码开关设置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-uboot%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4"><span class="nav-text">2. uboot相关命令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E8%BF%9B%E5%85%A5uboot"><span class="nav-text">2.1 进入uboot</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-EMMC%E5%92%8CSD%E5%8D%A1%E6%93%8D%E4%BD%9C"><span class="nav-text">2.2 EMMC和SD卡操作</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-1-mmc-rescan-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.2.1 mmc rescan 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-2-mmc-list-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.2.2 mmc list 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-3-mmc-dev-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.2.3 mmc dev 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-4-mmc-info-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.2.4 mmc info 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-5-mmc-part-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.2.5 mmc part 命令  </span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-FAT%E6%A0%BC%E5%BC%8F%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E6%93%8D%E4%BD%9C"><span class="nav-text">2.3 FAT格式文件系统操作</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-1-fatinfo-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.1 fatinfo 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-2-fatls-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.2 fatls 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-3-fstype-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.3 fstype 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-4-fatload-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.4 fatload 命令  </span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-5-fatwrite-%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.5 fatwrite 命令  </span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E6%89%8B%E5%8A%A8%E5%90%AF%E5%8A%A8%E5%86%85%E6%A0%B8"><span class="nav-text">3. 手动启动内核</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E8%BF%9B%E5%85%A5uboot%E7%95%8C%E9%9D%A2"><span class="nav-text">3.1 进入uboot界面</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E8%AE%BE%E7%BD%AEbootargs%E5%8F%82%E6%95%B0"><span class="nav-text">3.2 设置bootargs参数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E5%8A%A0%E8%BD%BD%E5%86%85%E6%A0%B8%E9%95%9C%E5%83%8F"><span class="nav-text">3.3 加载内核镜像</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E5%8A%A0%E8%BD%BD%E8%AE%BE%E5%A4%87%E6%A0%91"><span class="nav-text">3.4 加载设备树</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-%E5%90%AF%E5%8A%A8%E5%86%85%E6%A0%B8"><span class="nav-text">3.5 启动内核</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3"><span class="nav-text">4. 问题解决</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-JBD2%E2%80%94%E2%80%94%E9%97%AE%E9%A2%98%E4%B8%80"><span class="nav-text">4.1 JBD2——问题一</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-1-%E9%97%AE%E9%A2%98%E5%88%86%E6%9E%90"><span class="nav-text">4.1.1 问题分析</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-2-%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95"><span class="nav-text">4.1.2 解决方法</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-3-%E5%BC%80%E5%8F%91%E6%9D%BF%E9%AA%8C%E8%AF%81"><span class="nav-text">4.1.3 开发板验证</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-EXT2-fs%E2%80%94%E2%80%94%E9%97%AE%E9%A2%98%E4%BA%8C"><span class="nav-text">4.2 EXT2-fs——问题二</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E8%87%AA%E5%8A%A8%E6%8C%82%E8%BD%BD"><span class="nav-text">5. 自动挂载</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%94%E3%80%81%E5%81%9A%E6%88%90shell%E8%84%9A%E6%9C%AC"><span class="nav-text">五、做成shell脚本</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/f6996dcc.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV05-06-系统烧写-01-shell脚本烧写系统到SD卡 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV05-06-系统烧写-01-shell脚本烧写系统到SD卡
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-11-19 23:38:43" itemprop="dateCreated datePublished" datetime="2024-11-19T23:38:43+08:00">2024-11-19</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/" itemprop="url" rel="index"><span itemprop="name">LV05-系统镜像</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>14k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>51 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是系统烧写——在ubuntu中通过shell脚本制作一个sd卡启动盘的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.2的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.6.0 build-24238078</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，使用的uboot版本为U-Boot 2019.04</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.19.71(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="3">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/v4.19.71" target="_blank">nxp-imx/linux-imx/releases/tag/v4.19.71</a></td>        <td align="left">NXP linux内核仓库tags中的v4.19.71</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.19.35_1.1.0" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.19.35_1.1.0</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.19.35_1.1.0</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr>    <tr>        <td align="center" rowspan="2">Source Code</td>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/u-boot/latest/source" target="_blank">https://elixir.bootlin.com/u-boot/latest/source</a></td>        <td align="left">uboot源码</td>    </tr></table>
              </div>
            </details>

<h1 id="一、有哪些文件？"><a href="#一、有哪些文件？" class="headerlink" title="一、有哪些文件？"></a><font size=3>一、有哪些文件？</font></h1><p>前面我们学习linux系统组件，知道它包括uboot、kernel、设备树、根文件系统，我们前面做完移植，得到了下面这些文件。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110114412706.png" alt="image-20241110114412706" />

<p>前面我们将uboot的imx文件烧写到sd卡中，从tftp下载zImage和dtb，从nfs挂载根文件系统，那么我们怎么脱离网络启动？我们从这一节开始来详细学习一下系统的烧写。</p>
<h1 id="二、怎么给SD卡分区"><a href="#二、怎么给SD卡分区" class="headerlink" title="二、怎么给SD卡分区"></a><font size=3>二、怎么给SD卡分区</font></h1><p>首先，我们来学习一下SD卡分区，后面会知道为什么要先学习这个了。这里我们在ubuntu中操作。</p>
<h2 id="1-查看SD卡信息，确定挂载点"><a href="#1-查看SD卡信息，确定挂载点" class="headerlink" title="1. 查看SD卡信息，确定挂载点"></a><font size=3>1. 查看SD卡信息，确定挂载点</font></h2><h3 id="1-1-插入sd卡"><a href="#1-1-插入sd卡" class="headerlink" title="1.1 插入sd卡"></a><font size=3>1.1 插入sd卡</font></h3><p>首先我们要将SD卡插入PC电脑，保证vmware中的ubuntu识别到了sd卡，这个一般都没啥问题。</p>
<h3 id="1-2-相关命令"><a href="#1-2-相关命令" class="headerlink" title="1.2 相关命令"></a><font size=3>1.2 相关命令</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">fdisk -l # 查看系统真实存在的设备，也就是说，是一直处于动态监控设备状态，只要有一个设备‘消失’，它都会显示。</span><br><span class="line">cat /proc/partitions # 系统已识别的设备</span><br><span class="line">df -h</span><br></pre></td></tr></table></figure>

<p>注意： 查看系统真实存在的硬盘设备的时候</p>
<ul>
<li>查看系统真实存在的硬盘设备，看到的不一定是系统识别的</li>
<li>存在的，不一定是识别的</li>
<li>识别的，不一定是使用的</li>
<li>使用的，不一定是正在用的</li>
<li>系统真实存在的不一定能被识别，能识别的不一定能被用，能用的不一定是正在用</li>
</ul>
<h3 id="1-3-确定挂载点"><a href="#1-3-确定挂载点" class="headerlink" title="1.3 确定挂载点"></a><font size=3>1.3 确定挂载点</font></h3><p>然后我们通过下面的命令查看一下sd信息：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo fdisk -l</span><br></pre></td></tr></table></figure>

<p>然后会有如下打印信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125140902.png" alt="image-20241110125140902" />

<p>可以看到SD卡的扇区大小是512字节，挂载点是sdc。sd卡挂载之后的节点一般都是sd开头的，我们可以在&#x2F;dev下看到对应的节点：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls /dev/sd*</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125156470.png" alt="image-20241110125156470" />

<p>还有一个命令，可以直接打印出系统识别到的设备：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/partitions</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125213942.png" alt="image-20241110125213942" />

<p>反正最后能确定挂载点就可以了。</p>
<h2 id="2-卸载SD卡"><a href="#2-卸载SD卡" class="headerlink" title="2. 卸载SD卡"></a><font size=3>2. 卸载SD卡</font></h2><p>在进行分区操作时，我们需要先卸载SD卡：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">umount /dev/sdx</span><br></pre></td></tr></table></figure>

<p>上面是sdc，所以就是：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">umount /dev/sdc</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125231547.png" alt="image-20241110125231547" />

<p>要是没挂载就算了。</p>
<h2 id="3-分区操作"><a href="#3-分区操作" class="headerlink" title="3. 分区操作"></a><font size=3>3. 分区操作</font></h2><h3 id="3-1-进入分区菜单"><a href="#3-1-进入分区菜单" class="headerlink" title="3.1 进入分区菜单"></a><font size=3>3.1 进入分区菜单</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo fdisk /dev/sdc</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125253584.png" alt="image-20241110125253584" />

<h3 id="3-2-m——查看命令菜单"><a href="#3-2-m——查看命令菜单" class="headerlink" title="3.2 m——查看命令菜单"></a><font size=3>3.2 m——查看命令菜单</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">m</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125346905.png" alt="image-20241110125346905" />

<h3 id="3-3-p——查看当前SD卡状态"><a href="#3-3-p——查看当前SD卡状态" class="headerlink" title="3.3 p——查看当前SD卡状态"></a><font size=3>3.3 p——查看当前SD卡状态</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">p</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110125508014.png" alt="image-20241110125508014" />

<p>可以看到我这里SD卡有没有分区，在进行SD卡分区前，我们要删除所有分区。这个删除操作后面再说。</p>
<h3 id="3-4-创建分区"><a href="#3-4-创建分区" class="headerlink" title="3.4 创建分区"></a><font size=3>3.4 创建分区</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">n    # 新建一个分区</span><br><span class="line">p    # 使该分区为主分区</span><br><span class="line">1    # 输入分区号，这里使用1</span><br><span class="line">2048 # 输入第一个扇区大小2048</span><br><span class="line">+10M # 输入最后一个扇区大小，这里使用+10M，表示直接给该分区预留10MB</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130013750.png" alt="image-20241110130013750" />

<p>然后我们再用p看一下sd卡当前状态：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130147577.png" alt="image-20241110130147577" />

<p>可以看到这里产生了一个sdc1节点，大小为10M，这就是我们刚才制作的10M的分区。</p>
<h3 id="3-5-设置分区类型"><a href="#3-5-设置分区类型" class="headerlink" title="3.5 设置分区类型"></a><font size=3>3.5 设置分区类型</font></h3><p>上面已经创建好分区了，接下来就是设置分区的类型：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">t # 设置分区类型</span><br><span class="line">c #设置分区类型，至于这里为什么输入c，可以在设置分区类型的时候，按L查看不同分区格式对应的命令。我这里选择FAT32格式，根据自己需求选择即可</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">分区类型设置完成后，就可以看到系统打印出了相关的提示信息</span></span><br><span class="line"></span><br><span class="line">a # 设为引导分区</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130737351.png" alt="image-20241110130737351" />

<p>然后我们再查看一下分区的结果：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110130836816.png" alt="image-20241110130836816" />

<h3 id="3-6-写入分区"><a href="#3-6-写入分区" class="headerlink" title="3.6 写入分区"></a><font size=3>3.6 写入分区</font></h3><p>前面我们的分区实际上还并未生效，我们要输入w命令才可以：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">w # 写入分区</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131025774.png" alt="image-20241110131025774" />

<p>输入完成后会直接退出fdisk的菜单界面。</p>
<h3 id="3-7-格式化分区"><a href="#3-7-格式化分区" class="headerlink" title="3.7 格式化分区"></a><font size=3>3.7 格式化分区</font></h3><p>我们下来看一下我们分区好后的节点情况：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls /dev/sd*</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131146349.png" alt="image-20241110131146349" />

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo mkfs.vfat -F 32 -n boot /dev/sdc1</span><br></pre></td></tr></table></figure>

<ul>
<li><code>mkfs.vfat</code>：这是一个用于创建 VFAT 文件系统的命令。VFAT 是 FAT 文件系统的一个变种，它支持长文件名，通常用于 USB 闪存驱动器、SD 卡等存储设备。尽管名为 <code>vfat</code>，这个命令也可以用来创建标准的 FAT12、FAT16 和 FAT32 文件系统。</li>
<li><code>-F 32</code>：这个选项指定了要创建的 FAT 文件系统的类型。数字 <code>32</code> 表示创建一个 FAT32 文件系统。FAT32 支持更大的分区和文件大小，通常用于大于 2GB 的分区。</li>
<li><code>-n boot</code>：这个选项用来设置文件系统的卷标（volume label）。在这个例子中，卷标被设置为 <code>boot</code>。卷标是一个简短的文本字符串，用于在文件系统中标识分区，通常在挂载点、文件浏览器等地方显示。</li>
<li><code>/dev/sdc1</code>：这是指定要格式化的分区的设备文件。在 Linux 系统中，硬盘和分区通常以 <code>/dev/sdX</code> 的形式表示，其中 <code>X</code> 是字母，表示设备（如 <code>sda</code> 表示第一个硬盘），数字（如 <code>1</code>）表示分区号（如 <code>sda1</code> 表示第一个硬盘的第一个分区）。在这个例子中，<code>/dev/sdc1</code> 表示第三个硬盘的第一个分区。</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110131301570.png" alt="image-20241110131301570" />

<p>会发现这里报了个警告。</p>
<blockquote>
<p>先了解一下了解一下簇的概念和扇区的区别：</p>
<p>簇和扇区不是属于一个范畴。簇是系统在硬盘上读写文件时的单位，是一个数据块。而扇区是硬盘划分的最小单位值，就是簇（数据块）占用的地方。</p>
<p>簇的大小大于扇区的大小。硬盘每簇的扇区数与硬盘的总容量大小有关。扇区是存储介质上可由硬件寻址的基本单位，x86系统几乎总是定义512字节的扇区大小；簇是许多文件系统格式使用的可寻址数据块，簇的大小总是扇区大小的整数倍，且不同文件系统对于不同大小的卷（分区）会有不同的默认簇大小，比如FAT32对于8GB以下的分区，默认簇大小为4KB，对于8GB ~ 16GB的分区，默认簇大小为16个扇区（8KB），NTFS对于大于2GB的分区，默认簇大小为8个扇区（4KB）。<br>打个比方，我们（系统）要在仓库（仓库可视为硬盘）里存放一些书（数据）。我们先把书分门别类放到一些大纸箱（簇）里，然后放进仓库，纸箱的体积是根据我们仓库大小来决定的，而仓库始终划分成单位为0.1立方米的小格子（扇区），仓库大了，纸箱就大些，仓库小了，纸箱就小些。</p>
<p>制作fat32文件系统有个最小的簇的个数要求：这里扇区大小为512bytes，经测试当簇大小等于1个扇区时，分区最少需要40MB，当簇大小设为2个扇区时，分区至少需要80MB，40M &#x2F; 512 &#x3D; 81920, 80M &#x2F; 512 &#x2F; 2 &#x3D; 81920，计算出制作fat32的分区大小至少需要有81920个簇。</p>
</blockquote>
<p>我后面重新创建了一个40M的分区，然后格式化就没问题了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132615593.png" alt="image-20241110132615593" />

<p>这里这个这个警告信息是在提醒我们，在使用DOS或Windows系统时，使用小写的标签（labels）可能会导致一些问题或无法正常工作。这通常发生在处理文件系统、批处理脚本、环境变量或其他需要区分大小写的场景中，但DOS和早期版本的Windows（如Windows 95, 98, ME）的文件系统通常是不区分大小写的，而它们的某些命令行工具和环境变量处理却可能是区分大小写的。这里其实不用关心。</p>
<h3 id="3-8-删除分区"><a href="#3-8-删除分区" class="headerlink" title="3.8 删除分区"></a><font size=3>3.8 删除分区</font></h3><p>上面不是刚好报了警告，我们学习一下怎么删除分区：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">d # 删除分区</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132239941.png" alt="image-20241110132239941" />

<p>有多个分区？这个会提示我们选择要删除的分区的：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132424812.png" alt="image-20241110132424812" />

<h3 id="3-9-挂载分区"><a href="#3-9-挂载分区" class="headerlink" title="3.9 挂载分区"></a><font size=3>3.9 挂载分区</font></h3><p>格式化完成后我们需要将SD卡挂载到系统，直接点击系统边上的U盘图标（要是没有的画，直接拔掉重新插一下就可以了）：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132904767.png" alt="image-20241110132904767" />

<p>可以看到这里的卷标就是boot，使我们刚才设置的。我们还可以用df命令看一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">df -h</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110132956376.png" alt="image-20241110132956376" />

<p>我们也可以手动挂载：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo mkdir -p /mnt/sdc1_tmp             # mkdir命令创建一个空目录，用于挂载SD卡上的文件系统。</span><br><span class="line">sudo mount /dev/sdc1 /mnt/sdc1_tmp      # 挂载分区</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110133311760.png" alt="image-20241110133311760" />

<h3 id="3-10-卸载分区"><a href="#3-10-卸载分区" class="headerlink" title="3.10 卸载分区"></a><font size=3>3.10 卸载分区</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo umount &lt;sdcard mount dir&gt;</span><br></pre></td></tr></table></figure>

<h1 id="三、SD卡启动盘制作"><a href="#三、SD卡启动盘制作" class="headerlink" title="三、SD卡启动盘制作"></a><font size=3>三、SD卡启动盘制作</font></h1><h2 id="1-参考资料"><a href="#1-参考资料" class="headerlink" title="1. 参考资料"></a><font size=3>1. 参考资料</font></h2><p>NXP为我们提供了一份文档，，这个其实位于<a target="_blank" rel="noopener" href="https://www.nxp.com.cn/webapp/sps/download/preDownload.jsp?render=true">L4.1.15_2.0.0_LINUX_DOCS (nxp.com.cn)</a>这个压缩包内</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110133753211.png" alt="image-20241110133753211" />



<p>我们下载下来解压就可以看到：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134037145.png" alt="image-20241110134037145" />

<p>里面有一章在介绍这个：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134754488.png" alt="image-20241110134754488" />

<p>这里有一份在线的，<a target="_blank" rel="noopener" href="https://www.nxp.com/docs/en/user-guide/IMX_LINUX_USERS_GUIDE.pdf">i.MX Linux User’s Guide (nxp.com)</a>，但是不是这个4.15版本，不过都差不多。</p>
<h2 id="2-SD卡分区情况说明"><a href="#2-SD卡分区情况说明" class="headerlink" title="2. SD卡分区情况说明"></a><font size=3>2. SD卡分区情况说明</font></h2><p>先来看一下i.MX6ULL使用SD卡启动时的分区情况，NXP官方给的镜像布局结构如下所示（《i.MX Linux User’s Guide》的4.3 Preparing an SD&#x2F;MMC card to boot  ）：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110134940658.png" alt="image-20241110134940658" />

<p>可以看到，上图将一张SD卡分成了三部分：</p>
<p>第一部分：扇区起始地址0x400bytes(2)，大小为20478个扇区，分区格式为原始格式，用于存放uboot。0x400 bytes转为10进制是1024 bytes, 刚好等于2个扇区大小；这两个扇区是为了保存分区表的信息。所以从0x400地址开始存放U-boot，括号中的2可以理解为从第2个扇区的起始地址开始，扇区编号从0开始数起。</p>
<p>第二部分：扇区起始地址0xa0000 bytes（20480个扇区），大小为500M(1024000个扇区)，分区格式为FAT，用于存放内核和设备树；</p>
<p>第三部分：扇区起始地址0x25800000(1228800个扇区)，大小为SD卡剩余的空间，分区格式为Ext3或Ext4，用于存放rootfs，也就是文件系统。（注意：就这里其实有个坑的，我也不知道为啥，后面会说到这个地方，这里注意下）</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110140850593.png" alt="image-20241110140850593" />

<p>由于第一部分用于存放U-Boot，无文件系统格式的要求，所以我们对分区的创建从第二部分(第20480扇区所在的地址)开始就可以。拿到一张SD卡，首先将SD卡在windows下格式化成FAT32格式：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110141146802.png" alt="image-20241110141146802" style="zoom:33%;" />

<p>这里只有40M应该是因为我前面做实验的时候的第一个分区是40M的原因。</p>
<h2 id="3-对SD卡重新分区"><a href="#3-对SD卡重新分区" class="headerlink" title="3. 对SD卡重新分区"></a><font size=3>3. 对SD卡重新分区</font></h2><h3 id="3-1-确认节点名称"><a href="#3-1-确认节点名称" class="headerlink" title="3.1 确认节点名称"></a><font size=3>3.1 确认节点名称</font></h3><p>我这里重新插入ubuntu后节点是sdc：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110141814036.png" alt="image-20241110141814036" />

<p>可以看到是没有其他分区的，但有时候拿到的sd卡可能有分区，就按后面的继续处理。有分区的是这样的：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110153008072.png" alt="image-20241110153008072" />

<h3 id="3-2-卸载所有分区"><a href="#3-2-卸载所有分区" class="headerlink" title="3.2 卸载所有分区"></a><font size=3>3.2 卸载所有分区</font></h3><p>当有其他分区存在的时候，我们需要卸载所有分区</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ls /dev/sdc*</span><br><span class="line">sudo umount /dev/sdcxx</span><br></pre></td></tr></table></figure>

<h3 id="3-3-清空SD卡"><a href="#3-3-清空SD卡" class="headerlink" title="3.3 清空SD卡"></a><font size=3>3.3 清空SD卡</font></h3><p>一般来说清空前面的部分数据即可：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110153237641.png" alt="image-20241110153237641" />

<h3 id="3-4-两个分区"><a href="#3-4-两个分区" class="headerlink" title="3.4 两个分区"></a><font size=3>3.4 两个分区</font></h3><p>手册上fdisk的命令说明：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">sudo fdisk /dev/sdx</span></span><br><span class="line"></span><br><span class="line">p       # [lists the current partitions]</span><br><span class="line">d       # [to delete existing partitions. Repeat this until no unnecessary partitions are reported by the &#x27;p&#x27; command to start fresh.]</span><br><span class="line">n       # [create a new partition]</span><br><span class="line">p       # [create a primary partition - use for both partitions]</span><br><span class="line">1       # [the first partition]</span><br><span class="line">20480   # [starting at offset sector]</span><br><span class="line">1024000 # [size for the first partition to be used for the boot images]</span><br><span class="line">p       # [to check the partitions]</span><br><span class="line"></span><br><span class="line">n</span><br><span class="line">p</span><br><span class="line">2</span><br><span class="line">1228800 # [starting at offset sector, which leaves enough space for the kernel, the bootloader and its configuration data]</span><br><span class="line">&lt;enter&gt; # [using the default value will create a partition that extends to the last sector of the media]</span><br><span class="line">p       # [to check the partitions]</span><br><span class="line">w       # [this writes the partition table to the media and fdisk exits]</span><br></pre></td></tr></table></figure>

<p>这里我不按NXP的文档来了，主要是出现了这个问题，相同的步骤我按照NXP的文档，最后我挂载sdc2的时候出现了这个问题：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110155904254.png" alt="image-20241110155904254" />

<p>我按照网上的说法用下面这个命令处理：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo fsck -y /dev/sdc2 # 出现&quot;结构需要清理&quot;说明磁盘文献问题,需要使用这个命令进行检查修复</span><br></pre></td></tr></table></figure>

<p>但是最后没啥用，我甚至还怀疑是我sd卡有问题，然后我去试了正点原子教程的分区方式，就没问题，说明还是分区的问题。最后也没解决，不过，分区还是为了放文件，也没有必要那么严格的按照NXP文档来。后面我就按需要来了。</p>
<h4 id="3-4-1-分区1——64M"><a href="#3-4-1-分区1——64M" class="headerlink" title="3.4.1 分区1——64M"></a><font size=3>3.4.1 分区1——64M</font></h4><p>这个分区用于存放kernel和设备树文件，我们可以看一下这两个文件多大：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110165409967.png" alt="image-20241110165409967" />

<p>发现一个文件8M，一个文件27K，所以其实第一个分区根本没必要500M，这里给64M吧：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110170524143.png" alt="image-20241110170524143" />

<h4 id="3-4-2-分区2——剩余部分"><a href="#3-4-2-分区2——剩余部分" class="headerlink" title="3.4.2 分区2——剩余部分"></a><font size=3>3.4.2 分区2——剩余部分</font></h4><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171021545.png" alt="image-20241110171021545" />

<h4 id="3-4-3-设置分区格式"><a href="#3-4-3-设置分区格式" class="headerlink" title="3.4.3 设置分区格式"></a><font size=3>3.4.3 设置分区格式</font></h4><p>这里其实在NXP的文档中并没有，不过我看正点原子脚本中有，就也加上了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171407795.png" alt="image-20241110171407795" />

<p>这里主要是设置一下分区1的格式就行。然后我们再设置一下分区1为启动分区（官方文档没有这一步，正点原子的脚本有，这里就一起加上了）：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171614078.png" alt="image-20241110171614078" />

<h4 id="3-4-4-最终分区情况"><a href="#3-4-4-最终分区情况" class="headerlink" title="3.4.4 最终分区情况"></a><font size=3>3.4.4 最终分区情况</font></h4><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171635675.png" alt="image-20241110171635675" />

<h4 id="3-4-5-写入分区"><a href="#3-4-5-写入分区" class="headerlink" title="3.4.5 写入分区"></a><font size=3>3.4.5 写入分区</font></h4><p>最后的最后一定要输入w命令写入分区，确认分区的修改：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171734729.png" alt="image-20241110171734729" />

<h3 id="3-5-格式化分区"><a href="#3-5-格式化分区" class="headerlink" title="3.5 格式化分区"></a><font size=3>3.5 格式化分区</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置sdc1分区格式为FAT</span></span><br><span class="line">sudo mkfs.vfat -F 32 -n &quot;boot&quot; /dev/sdc1 # sdc1分区格式为FAT</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置sdc2分区格式为Ext3或Ext4都可以</span></span><br><span class="line">sudo mkfs.ext3 -F -L &quot;rootfs&quot; /dev/sdc2 # sdc2分区格式为Ext3</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">或者</span></span><br><span class="line">sudo mkfs.ext4 -F -L &quot;rootfs&quot; /dev/sdc2 # dc2分区格式为Ext4</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154318160.png" alt="image-20241110154318160" />

<h3 id="3-6-SD卡分区情况分析"><a href="#3-6-SD卡分区情况分析" class="headerlink" title="3.6 SD卡分区情况分析"></a><font size=3>3.6 SD卡分区情况分析</font></h3><p>我们来看一下最终的sd卡分区情况：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110171635675.png" alt="image-20241110171635675" />

<p>此时sd卡分布如下图：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110172120026.png" alt="image-20241110172120026" />

<p>前面好像就留了大概1M来写uboot，够吗》我们看一下uboot镜像文件的大小：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110172207362.png" alt="image-20241110172207362" />

<p>基本上够了，uboot只是拿来引导一下启动linux内核，也不会增加什么额外的功能，这个大小差不多够了。</p>
<h2 id="4-烧写uboot到sd卡"><a href="#4-烧写uboot到sd卡" class="headerlink" title="4. 烧写uboot到sd卡"></a><font size=3>4. 烧写uboot到sd卡</font></h2><p>这个和前面没什么区别，就是从偏移1KB的位置开始烧写uboot的imx文件即可：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dd if=u-boot-dtb.imx of=/dev/sdc bs=1024 seek=1 conv=fsync</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110162432151.png" alt="image-20241110162432151" />

<p>从上面我们对SD卡分区的时候知道，uboot需要从第0分区的扇区地址2开始的，SD卡中一个扇区占512字节，SD卡偏移1K字节处开始保存uboot。上面这条命令中，bs设置dd命令的读写块为1K大小(这个数据可以任意设置，设置大一点读写就快)，并且设置seek&#x3D;1(单位为KB)，表示从SD卡&#x2F;dev&#x2F;sdb开头偏移1K字节处开始写u-boot-dtb.imx，正好就是写到了u-boot在SD卡中0区所在位置处，前面预留1K字节刚好2个扇区大小保存分区表信息。</p>
<blockquote>
<p>为什么从SD卡1K位置处存放uboot而不是从SD卡头部开始？</p>
<p>这是NXP官方手册《i.MX Linux® User’s Guide 》上写前面1K字节是保存分区表的信息，在Rev. L4.1.15_2.0.0-ga, 10&#x2F;2016这个版本上没有，但是后面更新的文档都有说明了，例如这个：<a target="_blank" rel="noopener" href="https://www.nxp.com/docs/en/user-guide/IMX_LINUX_USERS_GUIDE.pdf">i.MX Linux User’s Guide (nxp.com)</a></p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110144506677.png" alt="image-20241110144506677" />
</blockquote>
<h2 id="5-拷贝kernel和dtbs"><a href="#5-拷贝kernel和dtbs" class="headerlink" title="5. 拷贝kernel和dtbs"></a><font size=3>5. 拷贝kernel和dtbs</font></h2><p>接下来就是把kernel和设备树拷贝到分区1中。</p>
<ul>
<li>创建挂载点</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p ~/tmp/sd_sdc1</span><br></pre></td></tr></table></figure>

<ul>
<li>挂载分区1</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo mount /dev/sdc1 ~/tmp/sd_sdc1 #  (注意根据上面的分区这是sdc1，存放kernal image和dtbs)</span><br></pre></td></tr></table></figure>

<ul>
<li>使用cp命令将zImage和*.dtb文件拷贝进&#x2F;media&#x2F;sd_sdc1目录</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo cp zImage ~/tmp/sd_sdc1/</span><br><span class="line">sudo cp imx6ull-alpha-emmc.dtb ~/tmp/sd_sdc1/</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154745853.png" alt="image-20241110154745853" />

<ul>
<li>取消挂载点</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo umount ~/tmp/sd_sdc1</span><br><span class="line">rm -rf ~/tmp/sd_sdc1</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110154853628.png" alt="image-20241110154853628" />

<h2 id="6-拷贝文件系统到SD卡"><a href="#6-拷贝文件系统到SD卡" class="headerlink" title="6. 拷贝文件系统到SD卡"></a><font size=3>6. 拷贝文件系统到SD卡</font></h2><h3 id="6-1-拷贝文件"><a href="#6-1-拷贝文件" class="headerlink" title="6.1 拷贝文件"></a><font size=3>6.1 拷贝文件</font></h3><p>和分区1的操作流程一样：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p ~/tmp/sd_sdc2</span><br><span class="line">sudo mount /dev/sdc2 ~/tmp/sd_sdc2</span><br><span class="line">sudo cp rootfs.tar.bz2 ~/tmp/sd_sdc2/</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110180201860.png" alt="image-20241110180201860" />

<h3 id="6-2-解压根文件系统"><a href="#6-2-解压根文件系统" class="headerlink" title="6.2 解压根文件系统"></a><font size=3>6.2 解压根文件系统</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo mkdir rootfs</span><br><span class="line">sudo tar -jxvf rootfs.tar.bz2 -C rootfs/</span><br><span class="line">cd rootfs/</span><br><span class="line">sudo tar -xf rootfs.tar </span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110180810646.png" alt="image-20241110180810646" />

<p>可能是打包方式问题吧，需要解压两次，但感觉又不应该，算了就这样吧。</p>
<h3 id="6-3-拷贝到顶层目录"><a href="#6-3-拷贝到顶层目录" class="headerlink" title="6.3 拷贝到顶层目录"></a><font size=3>6.3 拷贝到顶层目录</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cp -a * ~/tmp/sd_sdc2</span><br></pre></td></tr></table></figure>

<p>其实吧，直接在挂载的目录下解压就可以了，没必要多此一举，之前是以为有什么问题，后面直接挂载目录解压就可以。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110181039165.png" alt="image-20241110181039165" />

<h3 id="6-4-取消挂载"><a href="#6-4-取消挂载" class="headerlink" title="6.4 取消挂载"></a><font size=3>6.4 取消挂载</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo umount /dev/sdc2</span><br><span class="line">rm -rf ~/tmp/sd_sdc2</span><br></pre></td></tr></table></figure>

<h2 id="7-总结"><a href="#7-总结" class="headerlink" title="7. 总结"></a><font size=3>7. 总结</font></h2><p>到此为止，sd卡启动盘就算是做好了，我们已经在sd卡中烧写了uboot、kernel、dtb文件以及根文件系统：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110181634105.png" alt="image-20241110181634105" />

<h1 id="四、从SD卡启动"><a href="#四、从SD卡启动" class="headerlink" title="四、从SD卡启动"></a><font size=3>四、从SD卡启动</font></h1><h2 id="1-拨码开关设置"><a href="#1-拨码开关设置" class="headerlink" title="1. 拨码开关设置"></a><font size=3>1. 拨码开关设置</font></h2><p>我们要先设置为SD卡启动：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20240117190003663.png" alt="image-20240117190003663" style="zoom:50%;" />

<h2 id="2-uboot相关命令"><a href="#2-uboot相关命令" class="headerlink" title="2. uboot相关命令"></a><font size=3>2. uboot相关命令</font></h2><p>我们先复习几个命令，后面会用到的。</p>
<h3 id="2-1-进入uboot"><a href="#2-1-进入uboot" class="headerlink" title="2.1 进入uboot"></a><font size=3>2.1 进入uboot</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241110182125122.png" alt="image-20241110182125122" />

<h3 id="2-2-EMMC和SD卡操作"><a href="#2-2-EMMC和SD卡操作" class="headerlink" title="2.2 EMMC和SD卡操作"></a><font size=3>2.2 EMMC和SD卡操作</font></h3><p>我们来熟悉一下mmc相关的命令。uboot 支持 EMMC 和 SD 卡，因此也要提供 EMMC 和 SD 卡的操作命令。一般认为 EMMC<br>和 SD 卡是同一个东西 。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc</span><br><span class="line">mmc - MMC sub system</span><br><span class="line"></span><br><span class="line">Usage:</span><br><span class="line">mmc info - display info of the current MMC device</span><br><span class="line">mmc read addr blk# cnt</span><br><span class="line">mmc write addr blk# cnt</span><br><span class="line">mmc erase blk# cnt</span><br><span class="line">mmc rescan</span><br><span class="line">mmc part - lists available partition on current mmc device</span><br><span class="line">mmc dev [dev] [part] - show or set current mmc device [partition]</span><br><span class="line">mmc list - lists available devices</span><br><span class="line">mmc hwpartition [args...] - does hardware partitioning</span><br><span class="line">  arguments (sizes in 512-byte blocks):</span><br><span class="line">    [user [enh start cnt] [wrrel &#123;on|off&#125;]] - sets user data area attributes</span><br><span class="line">    [gp1|gp2|gp3|gp4 cnt [enh] [wrrel &#123;on|off&#125;]] - general purpose partition</span><br><span class="line">    [check|set|complete] - mode, complete set partitioning completed</span><br><span class="line">  WARNING: Partitioning is a write-once setting once it is set to complete.</span><br><span class="line">  Power cycling is required to initialize partitions after set to complete.</span><br><span class="line">mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode</span><br><span class="line"> - Set the BOOT_BUS_WIDTH field of the specified device</span><br><span class="line">mmc bootpart-resize &lt;dev&gt; &lt;boot part size MB&gt; &lt;RPMB part size MB&gt;</span><br><span class="line"> - Change sizes of boot and RPMB partitions of specified device</span><br><span class="line">mmc partconf dev [boot_ack boot_partition partition_access]</span><br><span class="line"> - Show or change the bits of the PARTITION_CONFIG field of the specified device</span><br><span class="line">mmc rst-function dev value</span><br><span class="line"> - Change the RST_n_FUNCTION field of the specified device</span><br><span class="line">   WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.</span><br><span class="line">mmc setdsr &lt;value&gt; - set DSR register value</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>可以看出， mmc 后面跟不同的参数可以实现不同的功能 :</p>
<table>
<thead>
<tr>
<th align="left">命令</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td align="left">mmc info</td>
<td>输出 MMC 设备信息</td>
</tr>
<tr>
<td align="left">mmc read</td>
<td>读取 MMC 中的数据。</td>
</tr>
<tr>
<td align="left">mmc wirte</td>
<td>向 MMC 设备写入数据。</td>
</tr>
<tr>
<td align="left">mmc rescan</td>
<td>扫描 MMC 设备。</td>
</tr>
<tr>
<td align="left">mmc part</td>
<td>列出 MMC 设备的分区。</td>
</tr>
<tr>
<td align="left">mmc dev</td>
<td>切换 MMC 设备。</td>
</tr>
<tr>
<td align="left">mmc list</td>
<td>列出当前有效的所有 MMC 设备。</td>
</tr>
<tr>
<td align="left">mmc hwpartition</td>
<td>设置 MMC 设备的分区。</td>
</tr>
<tr>
<td align="left">mmc bootbus……</td>
<td>设置指定 MMC 设备的 BOOT_BUS_WIDTH 域的值。</td>
</tr>
<tr>
<td align="left">mmc bootpart……</td>
<td>设置指定 MMC 设备的 boot 和 RPMB 分区的大小。</td>
</tr>
<tr>
<td align="left">mmc partconf……</td>
<td>设置指定 MMC 设备的 PARTITION_CONFG 域的值。</td>
</tr>
<tr>
<td align="left">mmc rst</td>
<td>复位 MMC 设备</td>
</tr>
<tr>
<td align="left">mmc setdsr</td>
<td>设置 DSR 寄存器的值。</td>
</tr>
</tbody></table>
<h4 id="2-2-1-mmc-rescan-命令"><a href="#2-2-1-mmc-rescan-命令" class="headerlink" title="2.2.1 mmc rescan 命令  "></a><font size=3>2.2.1 mmc rescan 命令  </font></h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc rescan</span><br></pre></td></tr></table></figure>

<p>好像没见打印输出，先不管。</p>
<h4 id="2-2-2-mmc-list-命令"><a href="#2-2-2-mmc-list-命令" class="headerlink" title="2.2.2 mmc list 命令  "></a><font size=3>2.2.2 mmc list 命令  </font></h4><p>list 命令用于来查看当前开发板一共有几个 MMC 设备，输入“mmc list”  ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc list</span><br><span class="line">FSL_SDHC: 0 (SD)</span><br><span class="line">FSL_SDHC: 1</span><br></pre></td></tr></table></figure>

<p>可以看出当前开发板有两个 MMC 设备： FSL_SDHC:0 和 FSL_SDHC:1 (eMMC)，这是因为我现在用的是 EMMC 版本的核心板，加上 SD 卡一共有两个 MMC 设备， FSL_SDHC:0 是 SD卡， FSL_SDHC:1(eMMC)是 EMMC。</p>
<h4 id="2-2-3-mmc-dev-命令"><a href="#2-2-3-mmc-dev-命令" class="headerlink" title="2.2.3 mmc dev 命令  "></a><font size=3>2.2.3 mmc dev 命令  </font></h4><p>mmc dev 命令用于切换当前 MMC 设备，命令格式如下  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mmc dev [dev] [part]</span><br></pre></td></tr></table></figure>

<p>dev用来设置要切换的 MMC 设备号， part是分区号。如果不写分区号的话默认为分区 0。使用如下命令切换到 SD 卡：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc dev 0 # 切换到 SD 卡， 0 为 SD 卡， 1 为 eMMC</span><br><span class="line">switch to partitions #0, OK</span><br><span class="line">mmc0 is current device</span><br></pre></td></tr></table></figure>

<h4 id="2-2-4-mmc-info-命令"><a href="#2-2-4-mmc-info-命令" class="headerlink" title="2.2.4 mmc info 命令  "></a><font size=3>2.2.4 mmc info 命令  </font></h4><p>mmc info 命令用于输出当前选中的 mmc info 设备的信息，输入命令“mmc info”即可：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc info</span><br><span class="line">Device: FSL_SDHC</span><br><span class="line">Manufacturer ID: 99</span><br><span class="line">OEM: 8888</span><br><span class="line">Name: W620X</span><br><span class="line">Bus Speed: 50000000</span><br><span class="line">Mode : SD High Speed (50MHz)</span><br><span class="line">Rd Block Len: 512</span><br><span class="line">SD version 1.10</span><br><span class="line">High Capacity: No</span><br><span class="line">Capacity: 1.9 GiB</span><br><span class="line">Bus Width: 4-bit</span><br><span class="line">Erase Group Size: 512 Bytes</span><br></pre></td></tr></table></figure>

<p>看出当前 SD 卡为 1.10 版本的，容量为 1.9GiB(2GB 的 SD 卡)， 4 位宽的总线。  </p>
<h4 id="2-2-5-mmc-part-命令"><a href="#2-2-5-mmc-part-命令" class="headerlink" title="2.2.5 mmc part 命令  "></a><font size=3>2.2.5 mmc part 命令  </font></h4><p>SD 卡或者 EMMC 会有多个分区，可以使用命令“mmc part”来查看其分区</p>
<ul>
<li>查看emmc分区</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc dev 1</span><br><span class="line">Card did not respond to voltage select!</span><br></pre></td></tr></table></figure>

<p>这里好像切换失败了，先不管吧，后面再说。</p>
<ul>
<li>查看sd卡分区</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">=&gt; mmc dev 0</span><br><span class="line">switch to partitions #0, OK</span><br><span class="line">mmc0 is current device</span><br><span class="line">=&gt; mmc part</span><br><span class="line"></span><br><span class="line">Partition Map for MMC device 0  --   Partition Type: DOS</span><br><span class="line"></span><br><span class="line">Part    Start Sector    Num Sectors     UUID            Type</span><br><span class="line">  1     2048            131072          0acdccb3-01     0c Boot</span><br><span class="line">  2     133120          3798016         0acdccb3-02     83</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>此时 SD卡 有两个分区， 第一个分区起始扇区为 2048，长度为 131072个扇区； 第二个分区起始扇区为 133120，长度为 3798016个扇区。如果 SD卡 里面烧写了 Linux 系统的话， SD 是有 3 个分区的，第 0 个分区存放 uboot，第 1 个分区存放Linux 镜像文件和设备树，第 2 个分区存放根文件系统。但是在上面只有两个分区，那是因为第 0 个分区没有格式化，所以识别不出来，实际上第 0 个分区是存在的。一个新的 SD卡默认只有一个分区，那就是分区 0，前面我们就是把uboot烧写到了分区0.</p>
<h3 id="2-3-FAT格式文件系统操作"><a href="#2-3-FAT格式文件系统操作" class="headerlink" title="2.3 FAT格式文件系统操作"></a><font size=3>2.3 FAT格式文件系统操作</font></h3><p>有时候需要在 uboot 中对 SD 卡或者 EMMC 中存储的文件进行操作，这时候就要用到文件操作命令，跟文件操作相关的命令有： fatinfo、 fatls、 fstype、 fatload 和 fatwrite，但是这些文件操作命令只支持 FAT 格式的文件系统！！  </p>
<h4 id="2-3-1-fatinfo-命令"><a href="#2-3-1-fatinfo-命令" class="headerlink" title="2.3.1 fatinfo 命令  "></a><font size=3>2.3.1 fatinfo 命令  </font></h4><p>fatinfo 命令用于查询指定 MMC 设备分区的文件系统信息 ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatinfo &lt;interface&gt; [&lt;dev[:part]&gt;]</span><br></pre></td></tr></table></figure>

<p>interface 表示接口，比如 mmc， dev 是查询的设备号， part 是要查询的分区。比如我们要查询 SD卡 分区 1 的文件系统信息 ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">=&gt; fatinfo mmc 0:1</span><br><span class="line">Interface:  MMC</span><br><span class="line">  Device 0: Vendor: Man 000099 Snr 00000700 Rev: 0.0 Prod: W620X</span><br><span class="line">            Type: Removable Hard Disk</span><br><span class="line">            Capacity: 1919.5 MB = 1.8 GB (3931136 x 512)</span><br><span class="line">Filesystem: FAT32 &quot;boot       &quot;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h4 id="2-3-2-fatls-命令"><a href="#2-3-2-fatls-命令" class="headerlink" title="2.3.2 fatls 命令  "></a><font size=3>2.3.2 fatls 命令  </font></h4><p>atls 命令用于查询 FAT 格式设备的目录和文件信息  ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatls &lt;interface&gt; [&lt;dev[:part]&gt;] [directory]</span><br></pre></td></tr></table></figure>

<p>interface 是要查询的接口，比如 mmc， dev 是要查询的设备号， part 是要查询的分区， directory是要查询的目录。比如查询 SD卡分区 1 中的所有的目录和文件，输入命令：    </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">=&gt; fatls mmc 0:1</span><br><span class="line">  8315704   zImage</span><br><span class="line">    27436   imx6ull-alpha-emmc.dtb</span><br><span class="line"></span><br><span class="line">2 file(s), 0 dir(s)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>可以看到分区1中就是zImage和dtb文件。</p>
<h4 id="2-3-3-fstype-命令"><a href="#2-3-3-fstype-命令" class="headerlink" title="2.3.3 fstype 命令  "></a><font size=3>2.3.3 fstype 命令  </font></h4><p>fstype 用于查看 MMC 设备某个分区的文件系统格式 ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fstype &lt;interface&gt; &lt;dev&gt;:&lt;part&gt;</span><br></pre></td></tr></table></figure>

<p>我们来看一下SD卡的几个分区：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">=&gt; fstype mmc 0:0</span><br><span class="line">** Unrecognized filesystem type **</span><br><span class="line">=&gt; fstype mmc 0:1</span><br><span class="line">fat</span><br><span class="line">=&gt; fstype mmc 0:2</span><br><span class="line">ext4</span><br><span class="line">=&gt; fstype mmc 0:4</span><br><span class="line">** Invalid partition 4 **</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>分区 0 格式未知，因为分区 0 存放的 uboot，并且分区 0 没有格式化，所以文件系统格式未知。分区 1 的格式为 fat，分区 1 用于存放 linux 镜像和设备树。分区 2 的格式为 ext4，用于存放 Linux 的根文件系统(rootfs)。  </p>
<h4 id="2-3-4-fatload-命令"><a href="#2-3-4-fatload-命令" class="headerlink" title="2.3.4 fatload 命令  "></a><font size=3>2.3.4 fatload 命令  </font></h4><p>fatload 命令用于将指定的文件读取到 DRAM 中  ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatload &lt;interface&gt; [&lt;dev[:part]&gt; [&lt;addr&gt; [&lt;filename&gt; [bytes [pos]]]]]</span><br></pre></td></tr></table></figure>

<p>interface 为接口，比如 mmc， dev 是设备号， part 是分区， addr 是保存在 DRAM 中的起始地址， filename 是要读取的文件名字。 bytes 表示读取多少字节的数据，如果 bytes 为 0 或者省略的话表示读取整个文件。 pos 是要读的文件相对于文件首地址的偏移，如果为 0 或者省略的话表示从文件首地址开始读取。我们将 SD卡分区 1 中的 zImage 文件读取到 DRAM 中的0X80800000 地址处，  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">=&gt; fatload mmc 0:1 80800000 zImage</span><br><span class="line">8315704 bytes read in 794 ms (10 MiB/s)</span><br></pre></td></tr></table></figure>

<h4 id="2-3-5-fatwrite-命令"><a href="#2-3-5-fatwrite-命令" class="headerlink" title="2.3.5 fatwrite 命令  "></a><font size=3>2.3.5 fatwrite 命令  </font></h4><p>注意！ uboot 默认没有使能 fatwrite 命令，需要修改板子配置头文件，比如 mx6ullevk.h、mx6ull_alpha_emmc.h 等等，板子不同，其配置头文件也不同。找到自己开发板对应的配置头文件然后添加如下一行宏定义来使能 fatwrite 命令：  </p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">define</span> CONFIG_FAT_WRITE <span class="comment">/* 使能 fatwrite 命令 */</span></span></span><br></pre></td></tr></table></figure>

<p>我用的这个2019版本的直接打开了好像，没打开的话在源码修改一下就可以了。fatwirte 命令用于将 DRAM 中的数据写入到 MMC 设备中，命令格式如下：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatwrite &lt;interface&gt; &lt;dev[:part]&gt; &lt;addr&gt; &lt;filename&gt; &lt;bytes&gt;</span><br></pre></td></tr></table></figure>

<p>interface 为接口，比如 mmc， dev 是设备号， part 是分区， addr 是要写入的数据在 DRAM中的起始地址， filename 是写入的数据文件名字， bytes 表示要写入多少字节的数据。我们可以通过 fatwrite 命令在 uboot 中更新 linux 镜像文件和设备树。  </p>
<p>所以我们可以在uboot下在线更新kernel镜像文件和设备树文件，我们可以直接从tftp下载这两个文件到内存中，然后写入到对应的分区中去。</p>
<p>我们以更新 linux 镜像文件 zImage为例，首先将 zImage 镜像文件拷贝到 Ubuntu 中的tftpboot 目录下，命令 tftp 将 zImage 下载到 DRAM 的 0X80800000 地址处，命令如下：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">=&gt; tftp 80800000 zImage</span><br><span class="line">ethernet@020b4000 Waiting for PHY auto negotiation to complete.... done</span><br><span class="line">Using ethernet@020b4000 device</span><br><span class="line">TFTP from server 192.168.10.101; our IP address is 192.168.10.102</span><br><span class="line">Filename &#x27;zImage&#x27;.</span><br><span class="line">Load address: 0x80800000</span><br><span class="line">Loading: #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         #################################################################</span><br><span class="line">         ###############################################</span><br><span class="line">         972.7 KiB/s</span><br><span class="line">done</span><br><span class="line">Bytes transferred = 8315704 (7ee338 hex)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>zImage 大小为 8315704(0x7ee338)个字节 ,接下来使用命令 fatwrite 将其写入到 SD卡的分区 1 中，文件名字为 zImage  ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">=&gt; fatwrite mmc 0:1 80800000 zImage 7ee338</span><br><span class="line">8315704 bytes written</span><br></pre></td></tr></table></figure>

<h2 id="3-手动启动内核"><a href="#3-手动启动内核" class="headerlink" title="3. 手动启动内核"></a><font size=3>3. 手动启动内核</font></h2><h3 id="3-1-进入uboot界面"><a href="#3-1-进入uboot界面" class="headerlink" title="3.1 进入uboot界面"></a><font size=3>3.1 进入uboot界面</font></h3><p>跟前面操作一样。</p>
<h3 id="3-2-设置bootargs参数"><a href="#3-2-设置bootargs参数" class="headerlink" title="3.2 设置bootargs参数"></a><font size=3>3.2 设置bootargs参数</font></h3><p>设置bootargs参数，指定根文件系统保存的路径：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">指定根文件系统在mmc设备0的2分区上。并且ip地址为静态ip地址</span></span><br><span class="line">=&gt; setenv bootargs &#x27;console=ttymxc0,115200 root=/dev/mmcblk0p2 ip=192.168.10.102:192.168.10.101:192.168.10.1:255.255.255.0::eth0:off init=/linuxrc&#x27;</span><br><span class="line">=&gt; saveenv</span><br><span class="line">Saving Environment to MMC... Writing to MMC(0)... OK</span><br></pre></td></tr></table></figure>

<p>这里主要是设置根文件系统的挂载路径，需要知道的是，不管是sd卡还是emmc在linux中的文件节点都叫mmcblk，这里的mmc0就表示sd卡，p2就表示sd卡的第二个分区，也就是我们前面创建的根文件系统所在分区。</p>
<h3 id="3-3-加载内核镜像"><a href="#3-3-加载内核镜像" class="headerlink" title="3.3 加载内核镜像"></a><font size=3>3.3 加载内核镜像</font></h3><p>加载zImage内核到内存的0x80800000地址上:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">=&gt; load mmc 0:1 0x80800000 zImage</span><br><span class="line">8315704 bytes read in 800 ms (9.9 MiB/s)</span><br></pre></td></tr></table></figure>

<p>其实和前面的fatload是一样的。</p>
<h3 id="3-4-加载设备树"><a href="#3-4-加载设备树" class="headerlink" title="3.4 加载设备树"></a><font size=3>3.4 加载设备树</font></h3><p>加载设备树到0x83000000内存地址上：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">=&gt; load mmc 0:1 0x83000000 imx6ull-alpha-emmc.dtb</span><br></pre></td></tr></table></figure>

<h3 id="3-5-启动内核"><a href="#3-5-启动内核" class="headerlink" title="3.5 启动内核"></a><font size=3>3.5 启动内核</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">=&gt; bootz 0x80800000 - 0x83000000</span><br><span class="line">Kernel image @ 0x80800000 [ 0x000000 - 0x7ee338 ]</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment"># Flattened Device Tree blob at 83000000</span></span></span><br><span class="line">   Booting using the fdt blob at 0x83000000</span><br><span class="line">   Using Device Tree in place at 83000000, end 83009b2b</span><br><span class="line">ft_system_setup for mx6</span><br><span class="line"></span><br><span class="line">Starting kernel ...</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">......</span></span><br></pre></td></tr></table></figure>

<p>然后内核就起来了，然后就出问题了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111210347645.png" alt="image-20241111210347645" />

<h2 id="4-问题解决"><a href="#4-问题解决" class="headerlink" title="4. 问题解决"></a><font size=3>4. 问题解决</font></h2><h3 id="4-1-JBD2——问题一"><a href="#4-1-JBD2——问题一" class="headerlink" title="4.1 JBD2——问题一"></a><font size=3>4.1 JBD2——问题一</font></h3><h4 id="4-1-1-问题分析"><a href="#4-1-1-问题分析" class="headerlink" title="4.1.1 问题分析"></a><font size=3>4.1.1 问题分析</font></h4><p>我们先来看这两行：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[    6.761505] JBD2: no valid journal superblock found</span><br><span class="line">[    6.766840] EXT4-fs (mmcblk0p2): error loading journal</span><br></pre></td></tr></table></figure>

<p>这里吧其实我没怎么深入研究，大概的原因就是新的操作系统上使用系统自带的 mkfs.ext4 对文件系统进行了格式化，默认使用了一些新的的特性，这些新的特性在旧的系统上是无法使用的，即在旧的内核上不支持。</p>
<p>我们可以看一下ubuntu的内核版本：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111210621620.png" alt="image-20241111210621620" />

<p>而我使用的linux内核是4.19版本的，也许是中间加入了某些新的特性吧。这里主要是journal相关的这个特性出了问题，怎么处理呢？网上搜了一堆，简单说就是把这个属性去掉就好了。</p>
<h4 id="4-1-2-解决方法"><a href="#4-1-2-解决方法" class="headerlink" title="4.1.2 解决方法"></a><font size=3>4.1.2 解决方法</font></h4><ul>
<li>（1）确定sd卡节点</li>
</ul>
<p>这里出问题的是sd卡的ext4分区，也就是sdx2，我的挂载上来就是sdc2：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/7Linux/imx6ull-alpha-release/release$ cat /proc/partitions </span><br><span class="line">major minor  #blocks  name</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">......</span></span><br><span class="line">   8       32    1965568 sdc</span><br><span class="line">   8       33      65536 sdc1</span><br><span class="line">   8       34    1899008 sdc2</span><br></pre></td></tr></table></figure>

<ul>
<li>（2）看分区journal日志</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo tune2fs -l /dev/sdc2 | grep feature</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111211758170.png" alt="image-20241111211758170" />

<p>发现是有这个has_journal特性，我们接下来要做的就是去掉这个特性。</p>
<ul>
<li>（3）卸载分区</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo mount /dev/sdc2</span><br></pre></td></tr></table></figure>

<ul>
<li>（4）修改分区journal日志</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo tune2fs -O ^has_journal /dev/sdc2</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111211925133.png" alt="image-20241111211925133" />

<ul>
<li>（5）检查是否成功</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo tune2fs -l /dev/sdc2 | grep feature</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111212008521.png" alt="image-20241111212008521" />

<p>发现已经没有了。</p>
<h4 id="4-1-3-开发板验证"><a href="#4-1-3-开发板验证" class="headerlink" title="4.1.3 开发板验证"></a><font size=3>4.1.3 开发板验证</font></h4><p>我们来验证一下，和前面的步骤一摸一样，正常应该是问题已经解决了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111212207419.png" alt="image-20241111212207419" />

<p>发现可以这次正常挂载了</p>
<h3 id="4-2-EXT2-fs——问题二"><a href="#4-2-EXT2-fs——问题二" class="headerlink" title="4.2 EXT2-fs——问题二"></a><font size=3>4.2 EXT2-fs——问题二</font></h3><p>甚至第二个问题也没了，大概应该是上面的问题一引起的第二个问题吧。那这里就不管了。</p>
<h2 id="5-自动挂载"><a href="#5-自动挂载" class="headerlink" title="5. 自动挂载"></a><font size=3>5. 自动挂载</font></h2><p>每次都要敲那么多的命令，其实uboot是有自动运行的命令的，就是bootcmd环境变量，在uboot启动后，会自动运行这个环境变量里面的命令。我们来配置一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置启动参数</span></span><br><span class="line">=&gt; setenv bootargs &#x27;console=ttymxc0,115200 root=/dev/mmcblk0p2 ip=192.168.10.102:192.168.10.101:192.168.10.1:255.255.255.0::eth0:off init=/linuxrc&#x27;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置命令</span></span><br><span class="line">=&gt; setenv bootcmd &#x27;mmc dev 0;fatload mmc 0:1 80800000 zImage;fatload mmc 0:1 83000000 imx6ull-alpha-emmc.dtb;bootz 80800000 - 83000000&#x27;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">保存环境变量</span></span><br><span class="line">=&gt; saveenv</span><br><span class="line">Saving Environment to MMC... Writing to MMC(0)... OK</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>然后我们复位开发板就会发现可以自动加载镜像和设备树，并且自动启动了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111213032658.png" alt="image-20241111213032658" />

<p>最后也是可以正常启动了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241111213103247.png" alt="image-20241111213103247" />

<h1 id="五、做成shell脚本"><a href="#五、做成shell脚本" class="headerlink" title="五、做成shell脚本"></a><font size=3>五、做成shell脚本</font></h1><p>每次敲那么多命令肯定很烦，做成shell脚本呗：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/imx6ull-alpha-release/blob/master/release/imx6ull_sd_boot.sh">release&#x2F;imx6ull_sd_boot.sh · 苏木&#x2F;imx6ull-alpha-release - 码云 - 开源中国 (gitee.com)</a></p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/LV05-06-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99-01-shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0SD%E5%8D%A1/img/image-20241112220637919.png" alt="image-20241112220637919" />

<blockquote>
<p>参考资料：</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_24330911/article/details/127623728">SD卡启动与uboot 、zImage、dtb、rootfs固化_怎么让 uboot kernel rootfs 在 sd 卡里运行-CSDN博客</a></p>
<p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/364817215">imx6ul基于zImage，dtb 在SD卡制作linux镜像 - 知乎 (zhihu.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_42670590/article/details/139336393?spm=1001.2101.3001.6650.14&utm_medium=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromBaidu~Rate-14-139336393-blog-64444029.235%5Ev43%5Epc_blog_bottom_relevance_base5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~BlogCommendFromBaidu~Rate-14-139336393-blog-64444029.235%5Ev43%5Epc_blog_bottom_relevance_base5">imx6ull开发板设置SD卡启动，SD卡中烧写uboot,kernel,设备树,根文件系统fs_imx6ull sd卡-CSDN博客</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/p1279030826/article/details/114976472">【问题解决】报错：EXT4-fs (mmcblk0p2): couldn‘t mount RDWR because of unsupported optional features (400)_ext4-fs error (device mmcblk0p2)-CSDN博客</a></p>
<p><a target="_blank" rel="noopener" href="https://developer.aliyun.com/article/693364">解决 EXT4 使用无法挂载-阿里云开发者社区 (aliyun.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://gitcode.csdn.net/66dfff6b522b003a5445c165.html?dp_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NTA1MzU2MCwiZXhwIjoxNzMxODE4MDI4LCJpYXQiOjE3MzEyMTMyMjgsInVzZXJuYW1lIjoicXFfMzgyMzEyNzkifQ.3uMGYwiAxfMV3MzeAx3y4h5woL673mDjx9_E-UrF1p0&spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~activity-2-73772282-blog-114976472.235%5Ev43%5Epc_blog_bottom_relevance_base5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~activity-2-73772282-blog-114976472.235%5Ev43%5Epc_blog_bottom_relevance_base5">linux开机启动挂载mmc错误解决_qqliyunpeng-GitCode 开源社区 (csdn.net)</a></p>
<p><a target="_blank" rel="noopener" href="https://erdong.site/linux/system/ext4-error-loading-journal.html">解决 EXT4 使用无法挂载 | Erdong’ Blog</a></p>
<p>[Linux如何关闭分区journal日志 - 飞入云端_blog - 博客园 (cnblogs.com)](<a target="_blank" rel="noopener" href="https://www.cnblogs.com/zhangyunfei-blog/p/9288482.html#:~:text=1.%E9%87%8D%E5%90%AF%E7%B3%BB%E7%BB%9F%EF%BC%8C%E8%BF%9B%E5%85%A5%E5%8D%95%E7%94%A8%E6%88%B7%E6%A8%A1%E5%BC%8F">https://www.cnblogs.com/zhangyunfei-blog/p/9288482.html#:~:text=1.重启系统，进入单用户模式</a> 2.查看要修改的分区 %23df -h 3.查看分区journal日志 (如%2Fdev%2Fsda1) %23tune2fs -l,|grep feature 查看是否有has_journal字段 4.以只读模式挂载根分区 %23mount -o remount%2Cro %2Fdev%2Fsda1)</p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/f6996dcc.html">LV05-06-系统烧写-01-shell脚本烧写系统到SD卡</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2024年11月19日 - 23:38</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/f6996dcc.html" title="LV05-06-系统烧写-01-shell脚本烧写系统到SD卡">https://sumumm.github.io/post/f6996dcc.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/LV05-%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/" rel="tag"><i class="fa fa-tag"></i> LV05-系统镜像</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/6dad760f.html" rel="prev" title="LV05-06-系统烧写-02-img镜像文件">
                  <i class="fa fa-angle-left"></i> LV05-06-系统烧写-02-img镜像文件
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/3ccb0d3b.html" rel="next" title="LV05-05-系统启动-01-系统启动过程">
                  LV05-05-系统启动-01-系统启动过程 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
